package map;

import java.util.ArrayList;
import java.util.ListIterator;

//an object to handle the current map position
public abstract class POV extends Grid {

	public static int x, y;
	Map holder;
	
	
	public static void left(ArrayList<Cell> cList) {
		if(x>0) {
			x-=50;	
			shift(50.0d,0.0d,cList);
		}
	}
	
	public static void right(ArrayList<Cell> cList) {
		if(x<(width-20)*TILESIZE) {
			x+=50;	
			shift(-50.0d,0.0,cList);
		}
	}
	
	public static void up(ArrayList<Cell> cList) {
		if(y>0) {
			y-=50;
			shift(0.0d,50.0d,cList);
		}
	}

	public static void down(ArrayList<Cell> cList) {
		if(y<(height-15)*TILESIZE) {
			y+=50;
			shift(0.0d,-50.0d,cList);
		}
	}
	
	//Methode zum Shiften der Karte
	public static void shift(double xshift, double yshift, ArrayList<Cell> cList){
		
		Cell current;
		ListIterator<Cell> it = cList.listIterator();		
		while(it.hasNext()) {
			current=it.next();
			current.move((double)xshift, (double)yshift);
		}
	
	}
	
	//Auf 0 setzen, nur zum "Kalibrieren"
	public static void setZero() {
		x=y=0;
	}
}
